{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}

  {% include 'TopxiaWebBundle:Thread/Part:common-header.html.twig' %}

  <div class="media topic-body">
    {% if thread.actvityPicture %}
      <div class="media-left">
        <img src="{{ thread.actvityPicture }}" alt="">
      </div>
    {% endif %}
    <div class="media-body">
      <p>时间：{{ thread.startTime|date('Y 年 m 月 d 日 ') ~ '周' ~ dict_text('week',thread.startTime|date('N')) ~ thread.startTime|date(' H:i') }}</p>
      {% if thread.location %}
        <p>地点： {{ thread.location }}</p>
      {% endif %}
      <p>报名人数：
          {% if thread.maxUsers == 0 %}
            {{ thread.memberNum }} 人 (名额不限)
          {% else %}
            {{ thread.memberNum }} 人 （剩余 {{ thread.maxUsers - thread.memberNum }}人）
          {% endif %}
      </p>
    </div>
    <div class="metas">
      {% if thread.maxUsers == thread.memberNum and thread.maxUsers != 0 %}
        <a class="btn btn-danger btn-sm disabled">名额已满</a>
        {% if member %}
          <a class="btn btn-link btn-sm js-event-cancel"  href="javascript:;" data-url="{{ path(thread.targetType ~ '_thread_members_quit', {memberId: member.id, threadId:thread.id, (thread.targetType ~ 'Id'):thread.targetId}) }}">取消报名</a>
        {% endif %}
      {% elseif member is empty %}
        <a class="btn btn-primary js-event-apply" data-toggle="modal" data-target="#modal" data-url="{{ path(thread.targetType ~ '_thread_members_become', {threadId:thread.id, (thread.targetType ~ 'Id'):thread.targetId}) }}">我要报名</a>
      {% else %}
        <a class="btn btn-success btn-sm js-event-apply disabled" data-toggle="modal" data-target="#modal" style="right:100px;">已报名</a>
        <a class="btn btn-link btn-sm js-event-cancel" href="javascript:;" data-url="{{ path(thread.targetType ~ '_thread_members_quit', {memberId: member.id, threadId:thread.id, (thread.targetType ~ 'Id'):thread.targetId}) }}">取消报名</a>
      {% endif %}
    </div>
  </div>



